import { assert } from "../common/assert.js";
import { isArray } from "../data-type/is.js";
/**
 * 移除数据项目
 */
export function deleteItem(data, callback, hook) {
    hook && hook()
    assert(isArray(data), 'argument[0] not an array');
    for (let i = data.length - 1; i >= 0; i--) {
        let result = callback(data[i], i) || false;
        if (result) data.splice(i, 1);
    }
    return data;
}